<?php
//* inherit params
extract($params = array(
	// product one
	'extra_class' => '',
	'show_title' => true,
	'shorten_title' => 0,
	'show_image' => true,
	'image_width' => 110,
	'image_height' => 160,
	'show_numbered' => false,
	'show_author' => true,
	'show_rating' => true,
	'show_price' => true,
	'price_text' => '',
	'show_description' => false,
	'shorten_description' => 500,
	'show_share' => true,
	'show_buttons' => false,
	'show_buy_button' => false,
	//'layout' => array('image', 'details' => 'open', 'title', 'title_url', 'author', 'rating', 'price', 'description', 'share', 'buttons', 'close'),
	'layout' => array('image', 'details' => 'open', 'title', 'title_url', 'author', 'rating', 'description', 'share', 'buttons', 'close'),
), EXTR_SKIP);

extract(array(
	'pagination_id' => '',
	'products' => array(),
	'force' => false,
	'columns' => 5,
	'title' => '',
	'title_url' => '',
	'class' => '',
	'products_class' => 'items-slider products-slider',
	'before_list' => false,
	'after_list' => false,
), EXTR_SKIP);

if ( !empty($products) || $force ) :  ?>

<section class="block <?php echo $class ?>">

	<h2 class="block-title link_store">
		<?php 
			if($title_url) echo '<a href="'.$title_url.'">'.$title.'</a>'; 
			else echo $title;
		?>
	</h2>

	<div class="block-content">

		<?php
		if ( empty($products) ) {
			printf('<div style="font-style: italic">%s</div>', 'Không có sản phẩm');
		} else {
		
			if ( !empty($pagination_id) ) {
				printf('<div class="pagination-contents" id="%s">', $pagination_id);
			}

			if ( !empty($before_list) ) {
				if ( is_array($before_list) && count($before_list) == 2 )
					$this->renderPartial($before_list[0], $before_list[1]);
				else
					echo $before_list;
			}

			$class = $products_class;
			$this->renderPartial('//common/products_list', compact('products', 'columns', 'id', 'class', array_keys($params)));

			if ( !empty($after_list) ) {
				if ( is_array($after_list) && count($after_list) == 2 ) 
					$this->renderPartial($after_list[0], $after_list[1]);
				else 
					echo $after_list;
			}

			if ( !empty($pagination_id) ) {
				printf('<!--%s--></div>', $pagination_id);
			}

		}
		?>
		
	</div>
	
</section>

<?php endif; ?>